/**
 * Created by hjqi on 2016/8/30.
 */
module.controller('ClusterCreateModController',
    function ($scope, $rootScope, $uibModalInstance, clusterService,$interval, $log, $http, $cookies,clusterService) {

        // 服务模板
        $scope.ok = function(){
            var _name = $scope.clusterName;
            if(_name !== undefined){
                //TODO add name to db in cluster collection
                clusterService.createCluster(_name).then(function(ret){
                    if(ret.data.ret === true){
                        $uibModalInstance.close(ret.data.data);
                    }
                }).catch(function(err){
                    alertify.alert("create cluster error",err.data.data);
                });
            }
        }

        $scope.cancel = function(){
            $uibModalInstance.dismiss('cancel');
        };
});
